import request from '@/utils/request'

/**
 * 新增文章
 * @param {*} status 
 * @param {*} article 
 * @returns 
 */
export const addArticle = (status,article) => {
    return request.post(`/admin/articles/save/${status}`,article)
}

/**
 * 分页条件查询文章列表
 * @param {*} obj 
 * @returns 
 */
export const getArticleListPageService = (obj) => {
    return request.get('/admin/articles/page', {
        params: obj
    })
}

/**
 * 批量删除文章
 * @param {Array} ids 
 * @returns 
 */
export const deleteBatchArticle = (ids) => {
    return request.delete('/admin/articles', {
        data: ids
    })
}

/**
 * 条件修改文章多种状态
 * @param {*} statusObj 
 * @returns 
 */
export const updateStatusBatchService = (batchArticleStatusDto,articleId) => {
    return request.put(`/admin/articles/update/status/${articleId}`, batchArticleStatusDto)
}

/**
 * 根据id查询文章数据
 * @param {*} id 
 * @returns 
 */
export const getArticleById = (id) => {
    return request.get(`/admin/articles/${id}`)
}

/**
 * 修改文章数据
 * @param {*} status 
 * @param {*} article 
 * @returns 
 */
export const updateArticleById = (status,article) => {
    return request.put(`/admin/articles/${status}`,article)
}